package com.workday.gridsimulator

abstract class Work(val id: Int, var startTime: Double, var arrivalTime: Double, var execTime: Double) extends Equals {

  var endTime: Double = -1.0
  
  override def toString = "Work id: " + id 

  def duration: Double = endTime - startTime
  
  def canEqual(other: Any) = {
    other.isInstanceOf[com.workday.gridsimulator.Work]
  }
  
  override def equals(other: Any) = {
    other match {
      case that: com.workday.gridsimulator.Work => that.canEqual(Work.this) && id == that.id && startTime == that.startTime && arrivalTime == that.arrivalTime && execTime == that.execTime
      case _ => false
    }
  }
  
  override def hashCode() = {
    val prime = 41
    prime * (prime * (prime * (prime + id.hashCode) + startTime.hashCode) + arrivalTime.hashCode) + execTime.hashCode
  }
}